Skip to content

[#1144] Standardize the API error envelope - #1160

Merged
greatest0fallt1me merged 1 commit into
CalloraOrg:mainfrom
Baskarayelu:feat/issue-1144-error-envelope
Aug 27, 2026
Merged

[#1144] Standardize the API error envelope#1160
greatest0fallt1me merged 1 commit into
CalloraOrg:mainfrom
Baskarayelu:feat/issue-1144-error-envelope

Conversation

@Baskarayelu

Copy link
Copy Markdown
Contributor

Summary

  • centralize public error-code and message normalization for every error-handler response
  • preserve safe, field-level validation details while removing stack traces and sensitive diagnostics
  • make unknown thrown values, upstream failures, and status-bearing errors JSON-safe and correlation-aware
  • add contract coverage for the global handler, response wrapper, legacy JSON sends, skipped binary streams, and response validation

Behavior

  • trusted application errors retain their documented public code and message
  • unknown 5xx failures always return a generic message; development diagnostics are limited to safe client errors
  • malformed validation details are bounded and sanitized before reaching clients
  • response envelopes are validated consistently and contract violations become safe 500 envelopes

Validation

  • npm test -- --runInBand src/errors/errorEnvelopePolicy.test.ts src/middleware/errorHandler.contract.test.ts src/middleware/envelope.error-contract.test.ts
  • npm run typecheck (blocked by the pre-existing syntax errors in src/routes/refresh-token.test.ts:445)

Closes #1144

@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Before merge, please complete the missing #1144 requirements: define the versioned error-envelope/OpenAPI mappings and add explicit contract coverage for the required auth, validation, conflict, rate-limit, and upstream failure responses. The current diff centralizes handling but does not update the documented API mappings or demonstrate all required failure classes.

@greatest0fallt1me
greatest0fallt1me merged commit fb32749 into CalloraOrg:main Aug 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GrantFox][Medium] Standardize the API error envelope

2 participants